import java.util.Random;
import java.util.Scanner;

public class text {
    public static void main(String[] args) {
        //打印九九乘法表
        for(int i = 1; i <= 9; i++){
            for(int j = 1; j <= i; j++){
                System.out.print(j+"*"+i +"="+i*j+" ");
            }
            System.out.println();
        }

    }
    public static void main11(String[] args) {
        //判断一个数是否为素数
        //方法一：除开1和它本身的数，逐个相除
        int num=2;
        int i=2;
        for (; i < num; i++) {
            if(num % i==0){
                System.out.println("不是是素数");
                break;
            }
        }
        if(i == num) {
            System.out.println("是素数");
        }
            System.out.println("========");
            //方法二：从2到n/2个数字相除
            int num2=16;
            int j=2;
            for(;j <= num2/2;j++){
                if(num2 % j == 0){
                    System.out.println("不是素数");
                    break;
                }
            }
            if(j>num2/2){
                System.out.println("是素数");
            }
        System.out.println("========");
            //方法二：从2到n开根号个数相除
        int num3=7;
        int m=2;
        for(;m<=Math.sqrt(num3);m++) {
            if (num3 % m == 0) {
                System.out.println("不是素数");
                break;
            }
        }
            if(m>Math.sqrt(num3)){
                System.out.println("是素数");
            }

    }
    public static void main10(String[] args) {
        //猜数字
        Scanner scan = new Scanner(System.in);
        Random random = new Random();
        //int randomNum = random.nextInt(100);//生成[0,100)的数字
        int randomNum = random.nextInt(50)+50;//[0,50)+50---->[50,100)
        System.out.println("作弊，电脑生产的随机数是："+randomNum);

        while(true){
            int num = scan.nextInt();
            if(num < randomNum){
                System.out.println("猜小了");
            }else if(num == randomNum){
                System.out.println("猜对了");
                break;
            }else {
                System.out.println("猜大了");
            }
        }
    }
    public static void main9(String[] args) {
        //从键盘上输入多个数据
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()){
            int a = scan.nextInt();
            System.out.println(a);
        }
    }
    //从键盘输入整数并输出
    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        System.out.println(a);
    }
    public static void main7(String[] args) {
        //用for循环计算1到5各个数的阶乘之和
        int sum=0;
        for ( int x = 1; x <= 5; x++) {
            int ret=1;
            for (int i = 1; i <= x; i++) {
                ret*=i;
            }
            sum+=ret;
        }
        System.out.println(sum);
    }
    public static void main6(String[] args) {
        //用continue打印即能被5整除，又能被6整除的数字
        int i=1;
        while(i<=100){
            if(i%30!=0){
                i++;
                continue;  //如果i是，就直接不进入if语句，可以直接打印i,否则就继续加1来判断
            }
            System.out.println(i);
            i++;
        }
    }
    public static void main5(String[] args) {
        //在1到10中找到一个个奇数并打印
        int i=1;
        while(i<=10){
            if(i%3==0){
                System.out.println(i);
                break;
            }
            i++;
        }
    }
    public static void main4(String[] args) {
        //计算1到5的各阶乘之和
       int x=1;
       int sum=0;
       while(x<6){
           int i=1;
           int ret=1;
           while(i<=x){
               ret*=i;
               i++;
           }
           //System.out.println(ret);//计算1到5各个数字的阶乘
           sum+=ret;
           x++;
       }
        System.out.println(sum);

    }
    public static void main3(String[] args) {
        //计算5的阶乘
        int x=5;
        int i=1;
        int ret=1;
        while(i<=x){
            ret=ret*i;
            i++;
        }
        System.out.println(ret);
    }
    public static void main2(String[] args) {
        //计算1到100的奇数和
        int i=1;
        int SumOdd=0;
        while(i<=100){
            SumOdd+=i;
            i+=2;
        }
        System.out.println(SumOdd);
        System.out.println("=======");
        //计算1到100的偶数和
        int a=2;
        int SumEven=0;
        while(a<=100){
            SumEven+=a;
            a+=2;

        }
        System.out.println(SumEven);
    }
    public static void main1(String[] args) {
        //计算1到100的和
        int i=1;
        int sum=0;
        while(i<=100){
            sum+=i;
            i++;
        }
        System.out.println(sum);

    }
}
